TK!2
=v
#1
:n

:s
b
:c
DOUBLE INTEGRAL: FUNCTION OF TWO VARS.
#2
:n
fun
:v
'f
:s
i
:c
name of function
#3
:n
a
:v
0
:s
i
:c
lower limit - outer integral
#4
:n
b
:v
1.5707963268
:s
i
:c
upper limit -   "      "
#5
:n
c
:v
0
:s
i
:c
lower limit - inner    "
#6
:n
d
:v
3.1415926536
:s
i
:c
upper limit -   "      "
#7
:n
m
:v
8
:s
i
:c
# of integration steps, inner integral
#8
:n
n
:v
4
:s
i
:c
#  "      "        "    outer integral
#9
:n
result
:v
28.1748781505491
:s
o
:c
value of the integral
=u
#1
:f
rad
:m
57.2957795129
:t
deg
=l
=f
#1
:n
dbintfl
:c
Double integration - composite Simpson's method
:t
Procedure
:i
fun,a,b,c,d,m,n
:o
VALUE
#2
:n
f
:c
Integrand
:t
Rule
:a
x,y
:v
z
#3
:n
graph3
:c
Three-dimensional graph of z=f(x,y)
:t
Procedure
:i
a,b,c,d,m,n
#4
:n
point
:c
Point generator for 'graph3'
:t
Rule
:a
x,y,k
#5
:n
base
:c
Base generator for 'graph3'
:t
Rule
:a
a,b,c,d
#1
:n
dbintfl
:z
" Notation:  fun    name of the rule or procedure function representing
"                   the integrand as a function of x,y
"            a,b    lower and upper limits of integration in x direction
"            c,d    lower and upper limits of integration in y direction
"            m      number of integration intervals in y direction
"            n      number of integration intervals in x direction
"            VALUE  value of the double integral

"                                               b   d
"                                              ô   ô
" This procedure evaluates the integral        ³   ³ fun(x,y) dy dx 
"                                              õ   õ
"                                               a   c
" using the composite Simpson's rule.

hx:= (b-a)/n
hy:= (d-c)/m
VALUE:= 0
x:= a
ki:= 4
for i=0 to n
   value:= apply(fun,x,c) + apply(fun,x,d)
   y:= c
   kj:= 2
   for j=1 to m-1
      y:= y+hy
      kj:= 6 - kj
      value:= value+kj*apply(fun,x,y) "accumulating the inner integral value
   next j
   value:= value*hy/3
   ki:= 6 - ki
   VALUE:= VALUE + ki*value           "accumulating the outer integral value
   if i=0 then VALUE:= VALUE - value
   x:= x+hx
next i
VALUE:= (VALUE-value)*hx/3
/E
E
#2
:n
f
:z
z = exp(x*sin(y)) + exp(y*cos(x))
/E
E
#3
:n
graph3
:z
hx:= (b-a)/n
hy:= (d-c)/m
dx:= (b-a)/20
dy:= (d-c)/20
call base(a,b,c,d)
k:= 6
x:= a
for i=0 to n
    y:= c
    for j=0 to 20              " z = f(y) curves for fixed x
       k:= k+1
       call point(x,y,k)
       y:= y+dy
    next j
    k:= k+1
    x:= x+hx
next i
y:= c
for i=0 to m
   x:= a
   for j=0 to 20              " z = f(x) curves for fixed y
      k:= k+1
      call point(x,y,k)
      x:= x+dx
   next j
   k:= k+1
   y:= y+hy
next i
/E
E
#4
:n
point
:z
z = f(x,y)
yy = .71*y
place('xp,k) = x + yy
place('yp,k) = z + yy
/E
E
#5
:n
base
:z
place('xp,1) = a + .71*c
place('yp,1) = .71*c
place('xp,2) = b + .71*c
place('yp,2) = .71*c
place('xp,3) = b + .71*d
place('yp,3) = .71*d
place('xp,4) = a + .71*d
place('yp,4) = .71*d
place('xp,5) = a + .71*c
place('yp,5) = .71*c
/E
E
=r
#1
:r
"             >>>>   D o u b l e   I n t e g r a l s   <<<<
:s
C
#3
:r
result = dbintfl(fun,a,b,c,d,m,n)
#4
:r
call graph3(a,b,c,d,m,n)           "generates points for a graph, see Note 3.
#7
:r
" 1. This model uses the composite Simpson's algorithm in the procedure
:s
C
#8
:r
"    function "dbintfl" for evaluating the integral
:s
C
#9
:r
"
:s
C
#10
:r
"       ô b  ô d                   ô ã/2  ô ã
:s
C
#11
:r
"       ³    ³                     ³      ³    x sin y      y cos x
:s
C
#12
:r
"       ³    ³  f(x,y) dy dx   =   ³      ³   e         +  e         dy dx
:s
C
#13
:r
"       ³    ³                     ³      ³
:s
C
#14
:r
"       õ a  õ c                   õ 0    õ 0
:s
C
#15
:r
"
:s
C
#16
:r
"    The integrand  f(x,y)  is defined in the rule function "f" - ready to be
:s
C
#17
:r
"    called from "dbintfl".
:s
C
#18
:r
"
:s
C
#19
:r
" 2. The procedure function "dbintfl" may be modified for handling variable
:s
C
#20
:r
"    limits of the inner integral - see model DINTEGV. 
:s
C
#21
:r
"
:s
C
#22
:r
" 3. A three-dimensional graph of the integrand within the integration limits
:s
C
#23
:r
"    may be displayed by pressing F7, after generating the graph data with 
:s
C
#24
:r
"    the procedure function "graph3", which is described in the model 3DGRAPH 
:s
C
#25
:r
"    in the \GRAPH directory.
:s
C
=p
#1
:n
surf
:t
Line chart
:d
EGA
:i
"z  =  exp(x*sin(y)) + exp(y*cos(x))"
:s
Yes
:z
None
:g
No
:l
None
:h
""
:v
""
:x
xp
:u
#1
:y
yp
:f
1
:p
Lines
:c
"*"
E
=t
=n
=g
#1
:c
.000001
:i
10
:v
Yes
:l
60
:f
66
:m
0
:w
80
:b
No
:a
Yes
:r
Yes
:h
No
:t
1
:n
No
:d
LPT1
%Tr,f,0,1,0,1,0
